package com.baijiaoxi.common.model.excel;

import com.baijiaoxi.common.constant.DateTime;
import com.baijiaoxi.common.model.UUID;

import java.util.Date;

public interface ExcelExportHandler {

    default ExcelExportJob createJob() {
        ExcelExportJob excelExportJob = new ExcelExportJob();
        excelExportJob.setJobName(getJobName());
        excelExportJob.setJobId(UUID.uuid());
        excelExportJob.setTargetSimpleFileName(excelExportJob.getJobId() + ".xls");
        return excelExportJob;
    }

    default String getJobName() {
        return getJobNamePrefix() + "（截止" + DateTime.FULL_DATE_NOSPLIT.format(new Date()) + "）";
    }

    default String getJobNamePrefix() {
        return "数据导出";

    }

    void export(String storage, ExcelExportJob excelExportJob) throws Exception;


}
